/*
Copyright 2025 PerfXLab (Beijing) Technologies Co., Ltd.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once

#include "OpenSparseBLAS_func.h"
#include "OpenSparseBLAS_type.h"
#include <stdlib.h>

#define OpenSpB_TYPE_CASE(type, object, SIZE) \
    case (type):                          \
        (*object)->element_size = SIZE;           \
        break;

#define OpenSpB_TYPE_CASES(object)            \
    OpenSpB_TYPE_CASE(OpenSpB_BOOL, object, 1);   \
    OpenSpB_TYPE_CASE(OpenSpB_INT8, object, 1);   \
    OpenSpB_TYPE_CASE(OpenSpB_INT16, object, 2);  \
    OpenSpB_TYPE_CASE(OpenSpB_INT32, object, 4);  \
    OpenSpB_TYPE_CASE(OpenSpB_INT64, object, 8);  \
    OpenSpB_TYPE_CASE(OpenSpB_UINT8, object, 1);  \
    OpenSpB_TYPE_CASE(OpenSpB_UINT16, object, 2); \
    OpenSpB_TYPE_CASE(OpenSpB_UINT32, object, 4); \
    OpenSpB_TYPE_CASE(OpenSpB_UINT64, object, 8); \
    OpenSpB_TYPE_CASE(OpenSpB_FP32, object, 4);   \
    OpenSpB_TYPE_CASE(OpenSpB_FP64, object, 8);   \
    default:                              \
        return OpenSpB_failure;

#define ZERO_BOOL false
#define ZERO_INT8 0
#define ZERO_INT16 0
#define ZERO_INT32 0
#define ZERO_INT64 0
#define ZERO_UINT8 0
#define ZERO_UINT16 0
#define ZERO_UINT32 0
#define ZERO_UINT64 0
#define ZERO_FP32 0.0f
#define ZERO_FP64 0.0f

#define ZERO_bool false
#define ZERO_int8_t 0
#define ZERO_int16_t 0
#define ZERO_int32_t 0
#define ZERO_int64_t 0
#define ZERO_uint8_t 0
#define ZERO_uint16_t 0
#define ZERO_uint32_t 0
#define ZERO_uint64_t 0
#define ZERO_float 0.0f
#define ZERO_double 0.0f